package controller.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.dao.UserAccessDao;
import model.dao.UserInfoDao;
import model.domain.UserInfoBean;

public class RegisterAction implements Action {

	@Override
	public String process(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
//		response.setHeader("command", "register");
		String userid = request.getParameter("userid");
//		String userpw = request.getParameter("userpw");  
//		Stirng username = request.getParameter("username:);
//		String gender = request.getParameter("gender");
//		String birthday = request.getParameter("birth");  아직  필요없는것들
		UserInfoBean bean = UserInfoDao.readUserInfo(userid);
		if(bean == null){
	    	//bean = new UserInfoBean(userid,userpw,username,gender,birthday);
			bean = new UserInfoBean("test","test","test","w","2010-10-11");//본격 실행시에는 지워야함
			UserInfoDao.insertUserInfo(bean);
			UserAccessDao.createUserTable(userid);
			return "회원등록 완료, 회원 테이블 생성 완료";
		}else{
			return "중복아이디 존재";
		}
	}
}
